
import 'package:baselib/utils/image_util.dart';
import 'package:baselib/widgets/inkwell_button.dart';
import 'package:flutter/material.dart';
import 'package:framelib/utils/color_util.dart';
import 'package:framelib/utils/px_util.dart';

class MainGradientButton extends StatelessWidget{

  Function onPressed;
  double width;
  double height;
  Gradient gradient;
  BorderRadiusGeometry borderRadius;
  String txt;
  Color txtColor;
  double txtFontSize;
  bool isImg;
  String imgPath;
  double imgWidth;
  MainGradientButton({
    this.onPressed,this.width,this.height,this.gradient,
    this.borderRadius,this.txt,this.txtColor,this.txtFontSize,
    this.isImg,this.imgPath,this.imgWidth
  });


  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return InkWellButton(
        onPressed: (onPressed==null)?((){}):onPressed,
        child: Container(
          width: width??PxUtil.instance.screenWidth,
          height: height??PxUtil.instance.px_50,
          decoration: BoxDecoration(
            gradient: gradient??LinearGradient(colors: [
              ColorUtil.instance.color_5808FB,
              ColorUtil.instance.color_9929EA,
            ]),
            border: Border(),
            borderRadius: BorderRadius.circular(
                borderRadius??PxUtil.instance.px_8),
          ),
          child: Center(
            child: (isImg??false)?
                ImagesUtil.loadAssetImage(
                    imgPath,
                  width: imgWidth,
                  fit: BoxFit.fitWidth
                ):
            Text(
              txt??'',
              style: TextStyle(
                  color: txtColor??ColorUtil.instance.color_white,
                  fontSize: txtFontSize??PxUtil.instance.px_16
              ),
            ),
          ),
        )
    );
  }

}